using System;
using System.Collections.Generic;
using System.Reflection;

namespace NetDns
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TTransport"></typeparam>
    public class Resolver<TTransport> : IResolver where TTransport : ITransport, new()
    {
        protected readonly List<IResourceRecord> resourceRecords = new List<IResourceRecord>();
        protected readonly ITransport transport;

        public Resolver() : this(new TTransport())
        {
        }

        public Resolver(ITransport transport)
        {
            this.transport = transport;
        }

        public TResourceRecord Query<TResourceRecord>(string hostname) where TResourceRecord : IResourceRecord
        {
            return default(TResourceRecord);
        }

        public IEnumerable<TResourceRecord> QueryAll<TResourceRecord>(string hostname) where TResourceRecord : IResourceRecord
        {
            yield break;
        }

        public IEnumerable<IResourceRecord> QueryAll(Question question)
        {
            yield break;
        }


        public void LoadResourceRecordsFromAssembly(Assembly asm)
        {
            Type[] types = asm.GetExportedTypes();
            Type interfaceType = typeof (IResourceRecord);

            foreach(Type type in types)
            {
                //if (type.IsAssignableFrom(interfaceType) && type.
            }
        }
    }
}